import React, { useMemo } from 'react'
// 订单总价组件
export default function Orderform_num(props) {
    let {goodsid} = props
    // 计算订单数量
    let num = useMemo(()=>{
        let nums = 0
        goodsid.forEach(nu=>{
            nums+=nu.count
        })
        return nums
    },[])
    // 计算订单价格
    let price = useMemo(()=>{
        let nums = 0
        goodsid.forEach(nu=>{
            nums+=nu.price*nu.count
        })
        return nums
    },[])
    return (
        <div className="orderform_ding_box_right">
            <p>共计{ num }件商品</p>
            <p>合计：<span style={{color:"#99bd92",fontSize:"0.36rem"}}>￥{ price }</span></p>
        </div>
    )
}
